<?php
	$htmlData = '';
	if (!empty($_POST['content1'])) {
		if (get_magic_quotes_gpc()) {
			$htmlData = stripslashes($_POST['content1']);
		} else {
			$htmlData = $_POST['content1'];
		}
	}
?>
<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title>KindEditor PHP</title>
    <script src="../style/js/jquery.js"></script>
    <script src="../style/js/bt.dwz.js"></script>

	<script>
    //此处考虑 upload_json.php，file_manager_json.php 两个PHP文件调用的位置问题，故JS代码放置于当前HTML中
     sdF.$(function () {
         // 关闭过滤模式，保留所有标签
         KindEditor.options.filterMode = false;
         KindEditor.create('textarea[name="content1"]', {
             uploadJson: 'editorphp/upload_json.php',
             fileManagerJson: 'editorphp/file_manager_json.php',
             allowFileManager: true,
             afterCreate: function () {
                 var self = this;
                 KindEditor.ctrl(document, 13, function () {
                     self.sync();
                     $("form[name=example]")[0].submit();
                 });
                 KindEditor.ctrl(self.edit.doc, 13, function () {
                     self.sync();
                     $("form[name=example]")[0].submit();
                 });
             }
         });
         prettyPrint();
     });

	</script>
</head>
<body>
    <h1>html在线编辑器</h1>
    <h2 class="lead">kindEditor</h2>
    <blockquote>
        <p>简单示例,php程序及文件的放置目录,在当前文件内(editorphp、attached),如使用,请自行配置</p>
    </blockquote>
    <br>
	<?php echo $htmlData; ?>
	<form class="bs-docs-example" name="example" method="post" action="editor.php">
		<textarea name="content1" style="width:700px;height:200px;visibility:hidden;"><?php echo htmlspecialchars($htmlData); ?></textarea>
		<br />
		<input type="submit" class="btn" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
	</form>
</body>
</html>

